{use master_page('admin/v_master')} 

{block content}

<?php $ci = &get_instance(); 
function bl_group($children,$level=1)
{
	$ci = & get_instance();
	foreach($children as $child)
	{
		$group = $child->name;
		$pad = "";
		for($i=0;$i<$level-1;$i++)
		{
			$pad = $pad . "----";
		}
		if($level == 1){
		$pad="+";
		}
		// $title = str_pad($title,'-',strlen($title)+level,STR_PAD_LEFT);

		echo "<option value='".$child->id."'>$pad$group</option>" ;
		if(sizeof($child->children)>0)
		{
			bl_group($child->children,$level+1);
		}
	}
}
?>

<div class="line"> 
<form action="<?=$_SERVER['REQUEST_URI']?>" method="post">
<div class="blank20" style="height:20px"></div>
	<div id="tagscontent" class="right_box">
	<table class="formtable" style="border:0px solid #cfcfcf;width:100%">
		<tr class='form_line'>
			<td class='title' width='15%'><?=lang('user_name')?></td>
			<td class='content'>
				<input name='p_name' size='48' value='<?=set_value('p_name', $name)?>' type='text' />  
				<?=form_error('p_name', '<font color="red">', '</font>')?>  
			</td>
		</tr>
		<tr class='form_line'>
			<td class='title' width='15%'><?=lang('user_nickname')?></td>
			<td class='content'>
				<input name='p_nickname' size='48' value='<?=set_value('p_nickname', $nickname)?>' type='text' />  
				<?=form_error('p_nickname', '<font color="red">', '</font>')?>  
			</td>
		</tr>
		<tr class='form_line'>
			<td class='title' width='15%'><?=lang('user_password')?></td>
			<td class='content'>
				<input name='password' size='48' value='' type='password' />  
				<?=form_error('password', '<font color="red">', '</font>')?>  
			</td>
		</tr> 
		<tr class='form_line'>
			<td class='title' width='15%'><?=lang('user_phone')?></td>
			<td class='content'>
				<input name='p_phone' size='48' value='<?=set_value('p_phone', $phone)?>' type='text' />  
				<?=form_error('p_phone', '<font color="red">', '</font>')?>  
			</td>
		</tr>
		<tr class='form_line'>
			<td class='title' width='15%'><?=lang('user_qq')?></td>
			<td class='content'>
				<input name='p_qq' size='48' value='<?=set_value('p_qq', $qq)?>' type='text' />  
				<?=form_error('p_qq', '<font color="red">', '</font>')?>  
			</td>
		</tr>
		<tr class='form_line'>
			<td class='title' width='15%'><?=lang('user_email')?></td>
			<td class='content'>
				<input name='p_email' size='48' value='<?=set_value('p_email', $email)?>' type='text' />  
				<?=form_error('p_email', '<font color="red">', '</font>')?>  
			</td>
		</tr> 
		
		
		<?$group = $this->usergroup_manager->get($this->input->get('group_id'));?>
		<?$children = 
			!empty($_GET['group_id'])?$group->children:$this->usergroup_manager->get_root_list();?>
		
		<tr class='form_line'> 
			<td class='title'><?=lang('user_group')?></td>
			<td class='content'>
				
				<select id = 'usergroup_id' class='bind'>
					<option value ="">请选择</option>
					<?php if(!empty($_GET['group_id'])):?>
					<option value='<?php echo $group->id?>'><?php echo $group->name?></option>  
					<?php endif;?>
					<?php bl_group($children,1)?>
				</select>  
				<input name='p_usergroup_id' value='<?=set_value('p_usergroup_id', $usergroup_id)?>' type='hidden' />   
				<?=form_error('p_usergroup_id', '<font color="red">', '</font>')?>   
			</td>
		</tr>
	
	</table>
	</div>
		<div class="blank20"style="height:20px"></div>
		<input type="submit" name="submit" value=" 提交 " class="btn_a">
</form>
</div>  

{end}  